package com.grm.task.manager.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

@AllArgsConstructor
@Getter
public enum TaskStatusEnum {
    // 失败
    FAILED(5,"失败"),
    // 成功
    SUCCESS(4,"成功"),
    // 等待中
    WAITING(3,"等待中"),
    // 运行中
    RUNNING(2,"运行中"),
    // 未提交
    NO_SUBMIT(1,"未提交"),
    ;
    public int status;
    public String statusCn;

    public static String queryCnByStatus(int status){
        String statusCn = "";
        TaskStatusEnum[] taskStatusEnums = values();
        for (TaskStatusEnum taskStatusEnum : taskStatusEnums) {
            if(taskStatusEnum.getStatus() == status){
                statusCn = taskStatusEnum.getStatusCn();
                break;
            }
        }
        return statusCn;
    }
}
